<script>
	import { useUserStore } from '@/store/user.js'
	import { useSystemStore } from '@/store/system.js'
	import { useGeneralStore } from '@/store/general.js'
	export default {
		onLaunch: function() {
			this.init();
			this.initData();
		},
		onShow: function() {},
		onHide: function() {},
		methods: {
			async init() {
				const userStore = useUserStore();
				const systemStore = useSystemStore();
				const generalStore = useGeneralStore();

				userStore.init();
				systemStore.init();
				generalStore.init();
			},
			initData() {
				// #ifdef MP
				const updateManager = uni.getUpdateManager();
				updateManager.onCheckForUpdate(function(res) {});
				updateManager.onUpdateFailed(function(res) {});
				updateManager.onUpdateReady(function(res) {
					uni.showModal({
						title: '更新提示',
						content: '新版本已经准备好，是否重启应用？',
						success(res) {
							if (res.confirm) {
								updateManager.applyUpdate();
							}
						}
					});
				});
				// #endif
			}
		}
	}
</script>

<style lang="scss">
	@import "@/assets/css/animation.scss";
	@import '@/assets/css/common.scss';
	@import '@/assets/font/iconfont.css';
	@import '@/uni_modules/uv-ui-tools/index.scss';
</style>